package com.shop.pojo;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**
 * <p>
 * 商品分类 
 * </p>
 *
 * @author Administrator
 * @since 2020-10-31
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("category")
public class Category implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = ID, type = IdType.AUTO)
    private String id;

    /**
     * 分类名称
     */
    @TableField(NAME)
    private String name;

    /**
     * 分类类型
     */
    @TableField(TYPE)
    private Integer type;

    /**
     * 父id
     */
    @TableField(FATHER_ID)
    private Integer fatherId;

    /**
     * 图标
     */
    @TableField(LOGO)
    private String logo;

    /**
     * 口号
     */
    @TableField(SLOGAN)
    private String slogan;

    /**
     * 分类图
     */
    @TableField(CAT_IMAGE)
    private String catImage;

    /**
     * 背景颜色
     */
    @TableField(BG_COLOR)
    private String bgColor;


    public static final String ID = "`id`";

    public static final String NAME = "`name`";

    public static final String TYPE = "`type`";

    public static final String FATHER_ID = "`father_id`";

    public static final String LOGO = "`logo`";

    public static final String SLOGAN = "`slogan`";

    public static final String CAT_IMAGE = "`cat_image`";

    public static final String BG_COLOR = "`bg_color`";


    public static final String ID_COMMENT = "主键";

    public static final String NAME_COMMENT = "分类名称";

    public static final String TYPE_COMMENT = "分类类型";

    public static final String FATHER_ID_COMMENT = "父id";

    public static final String LOGO_COMMENT = "图标";

    public static final String SLOGAN_COMMENT = "口号";

    public static final String CAT_IMAGE_COMMENT = "分类图";

    public static final String BG_COLOR_COMMENT = "背景颜色";



    public static Category of(Object obj) {
        Category e = new Category();
        BeanUtils.copyProperties(obj, e);
        return e;
    }

    public static QueryWrapper<Category> queryWrapper(Object obj) {
        return new QueryWrapper<>(of(obj));
    }

}
